<template>
  <div class="execution">
    <basic-container>
      <avue-crud
        v-model="form"
        v-bind="bindVal"
        v-on="onEvent"
        :page.sync="page"
        :permission="permissionList">
        <template slot="menuLeft">
          <el-popover v-if="permissions.stm_swstcycleapply_audit" placement="bottom" width="260">
            <div style="text-align: center; margin: 0">
              <el-button size="mini" type="primary" @click="handleAudit(1)">审核通过</el-button>
              <el-button type="primary" size="mini" @click="handleAudit(2)">审核不通过</el-button>
            </div>
            <el-button type="primary" size="small" slot="reference">审核</el-button>
          </el-popover>
        </template>
      </avue-crud>
    </basic-container>
  </div>
</template>

<script>
  import baseCrud from '@/mixins/base-crud'
  import {audit} from '@/api/subway/swstspecialcardmanage'
  import { startDate, endDate } from "@/const/crud/subway/swstspecialcardmanage";
  import {mapGetters} from 'vuex'

  export default {
    name: 'StSpecialApply',
    mixins: [baseCrud('subway/swstspecialcardmanage')],
    data() {
      return {
        searchForm: {
          dates1: [startDate, endDate]
        }
      }
    },
    computed: {
      permissionList() {
        return {}
      }
    },
    methods: {
      handleAudit(checkStatus) {
        var tableSelect = this.$refs.crud.tableSelect
	var tipMessage ='审核通过操作成功'
	if(checkStatus==2){
	  tipMessage = '审核不通过操作成功'
	}
        if(tableSelect.length == 0){
          this.$message.info('请选择要审核的记录')
          return
        }
        tableSelect.forEach(row => {
          row.checkStatus = checkStatus
        })
        audit(tableSelect).then(response => {
          this.$message.success(tipMessage)
          this.getList(this.page);
        })
      },
    }
  }
</script>

<style lang="scss" scoped>
</style>
